<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

use Bican\Roles\Traits\HasRoleAndPermission;
use Bican\Roles\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;

class User extends Authenticatable implements HasRoleAndPermissionContract
{
	use Notifiable;
	use HasRoleAndPermission;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'mobile', 'email', 'password','parent_id','lft','rgt','depth','avatar','balance','frozen_funds','is_agent','is_maker','commission_rate'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function financialDetails()
    {
         return $this->hasMany('App\Models\FinancialDetails');
    }

    public function commissions()
    {
         return $this->hasMany('App\Models\Commission','commission_user_id');
    }

    public function activity()
    {
        return $this->hasMany('App\Models\StockActivity','user_id');
    }

    public function order()
    {
        return $this->hasMany('App\Models\Order','user_id');
    }

    public function recharge()
    {
        return $this->hasMany('App\Models\Recharge','user_id');
    }

    public function withdrawals()
    {
        return $this->hasMany('App\Models\Withdrawals','user_id');
    }

}
